package dfsketches.gr3d;

public class AnimationInfo {

	Animation curAnim;
	float curTime;
	float speed;
	long lastAnimationMillis;
	
	public AnimationInfo(Animation ani, float start, float speed) {
		lastAnimationMillis = System.currentTimeMillis();
		curAnim = ani;
		curTime = start;
		this.speed = speed;
	}
	
	public void update() {
		curTime += (System.currentTimeMillis() - lastAnimationMillis) * speed;
		lastAnimationMillis = System.currentTimeMillis();
	}

	public Matrix3D getTransformation(Bone ancBone) {
		return curAnim.getTransformation(ancBone, curTime);
	}

	public Matrix3D getTransformation(Bone ancBone, Matrix3D output) {
		return curAnim.getTransformation(ancBone, curTime, output);
	}

	public void changeAnimationSpeed(float newSpeed) {
		speed = newSpeed;
	}
	
}
